import user.AdminUser;
import user.NormolUser;
import user.User;

import java.util.Scanner;

public class Main {

    public static User login() {
        System.out.println("请输入姓名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("******1.普通用户  2.管理员用户*******");
        System.out.println("请输入身份：");
        int choice = scanner.nextInt();
        if(choice == 1) {
            //普通用户
            return new NormolUser(name);
        }else {
            //管理员
            return new AdminUser(name);
        }
    }
    public static void main(String[] args) {
        User user = login();
        int choice = 1;
        while(choice != 0) {
            choice = user.menu();
            if((choice < 4) || (choice < 5)) {
                System.out.println("choice: " + choice);
                user.doOperation(choice);
            }else  {
                System.out.println("输入错误，请重新输入");
            }

        }

    }
}